import Vue from 'vue'
import VueRouter from 'vue-router'
import MainLayout from '@/layout/Sidebar/index.vue'

Vue.use(VueRouter)

const routes = [

  {
    path: '/404',
    component: () => import('@/views/error/404'),
    hidden: true
  },

  {
    path: '/',
    name: 'Home',
    component: MainLayout,
    redirect: '/dashboard',
    children: [{
      path: '/dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: { title: 'Dashboard', icon: 'dashboard' }
    }]
  },


  {
    path: '/b',
    name: '404',
    component: MainLayout,
    redirect: '/a',
    children: [{
      path: '/a',
      name: '404index',
      component: () => import('@/views/error/404'),
      meta: { title: 'Dashboard', icon: 'dashboard' }
    }]
  },


  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
